package fields;

import game.Player;

public class Tax extends Field {

	private int taxAmount; //2000 4000 or 10 per cent
	private int taxRate;
	private int tax;
	
	public Tax(int number, String name, int taxAmount) { //Konstruktør
		super(number, name);
		this.taxAmount = taxAmount; //2000 4000 or 10 per cent
		taxRate = 10;
		tax=0;
	}
	
	public void landOnField(Player sp) {
		if (sp.getChoice())
		{
			tax=taxAmount;
			sp.withdraw(tax);
			sp.setChoice(false);
		} else {
			tax=(sp.calculateTotalAssets()/taxRate);
			sp.withdraw(tax);
		}
	}
	
	public String fieldInfo(Player p) {
		return p.getName()+" have to pay "+taxAmount+".";
	}
	
}
